import { req_bannerList, req_floor } from '../../api/req_fun'
import { Message } from 'element-ui'
export default {
    namespaced: true,
    state: () => ({
        bannerList: [],
        floorList: [],

    }),
    actions: {
        async get_bannerList({ commit}) {
            const data = await req_bannerList()
            if (data.code >= 200 && data.code < 300) {
                commit('GET_BANNERLIST', data.data)
            } else {
                Message.error('请求错误!')
            }

        },
        async get_floor({ commit}) {
            const data = await req_floor()
            if (data.code >= 200 && data.code < 300) {
                commit('GET_FLOOR', data.data)
            } else {
                Message.error('请求错误!')
            }

        }
    },
    mutations: {
        GET_BANNERLIST(state, data) {
            state.bannerList = data
        },
        GET_FLOOR(state, data) {
            state.floorList = data
        }
    },
    getters: {}
}